// pages/InvitationCards/InvitationCards.js
var http = require("../../utils/http.js");
Page({

  /**
   * 页面的初始数据
   */
  data: {
    shareWxCode:""
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.genWeixinCode();
  },

  /**
  * 生成小程序二维码
  */
  genWeixinCode() {
    wx.showLoading({
      mask: true
    })
    var cardno = wx.getStorageSync("distCardNo");
    http.request({
      url: "/p/distribution/qrCode/invitation",
      method: "GET",
      responseType: 'arraybuffer',
      data: {
        page: "pages/applyDistCon/applyDistCon",
        //page: "pages/prod/prod",
        scene: cardno
      },
      callBack: (res) => {
        this.setData({
          shareWxCode: "data:image/jpg;base64," + wx.arrayBufferToBase64(res)
        });
        wx.hideLoading();
      }
    })
  },
})
